package com.currency.mall.adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.currency.mall.R;
import com.currency.mall.entity.TradingRecordBean;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by Administrator on 2018/12/5.
 */

public class TradingRecordAdapter extends BaseQuickAdapter<TradingRecordBean, BaseViewHolder> {

    public TradingRecordAdapter(@Nullable List<TradingRecordBean> data, Context context) {
        super(R.layout.item_trading_record, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TradingRecordBean tradingRecordBean) {
        BigDecimal bd = new BigDecimal(tradingRecordBean.getValue());
        String value = bd.toPlainString();
        if("0".equals(tradingRecordBean.getType())){//0转入1转出
            helper.setText(R.id.tv_type,R.string.roll_in_text);
            helper.setText(R.id.tv_num,"＋ "+tradingRecordBean.getValue());
        }else if("1".equals(tradingRecordBean.getType())){
            helper.setText(R.id.tv_type,R.string.roll_out_text);
            helper.setText(R.id.tv_num,"－ "+tradingRecordBean.getValue());
        }

        helper.setText(R.id.tv_status,R.string.completed_text);
        helper.setText(R.id.tv_time,tradingRecordBean.getOperationTime());


    }

}
